package com.knife.hospital.controller;

import com.knife.hospital.config.BaseResponse;
import com.knife.hospital.entity.ArrangementPO;
import com.knife.hospital.entity.DoctorPO;
import com.knife.hospital.entity.OrderPO;
import com.knife.hospital.model.OrderDoctor.DocOrderRequest;
import com.knife.hospital.model.OrderDoctor.DocOrderResponse;
import com.knife.hospital.model.OrderDoctor.DoctorInfoResponse;
import com.knife.hospital.service.QueryDoctor.QueryDoctorInfoService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Controller
@CrossOrigin
@ResponseBody
@BaseResponse
@RestController
public class DoctorInfoController {
    @Resource
    private QueryDoctorInfoService queryDoctorInfoService;

    @GetMapping("api/doctor/getDoctorInfo/{id}")
    public DoctorInfoResponse getDoctorInfo(@PathVariable("id") int id)
    {
        return queryDoctorInfoService.getDoctorInfo(id);
    }

    @GetMapping("api/doctor/getAllOrder/{id}")
    public List<OrderPO> getUserOrdersByPatientId(@PathVariable("id") int id){
        return queryDoctorInfoService.getUserOrdersByPatientId(id);
    }

    @PostMapping("api/doctor/getOrderByDate")
    public  List<DocOrderResponse> getOrderByDate(@RequestBody DocOrderRequest docOrderRequest){
        return queryDoctorInfoService.getOrderByDate(docOrderRequest);
    }

    @PostMapping("api/doctor/getArrangement")
    public List<ArrangementPO> getArrangement(@RequestBody DocOrderRequest docOrderRequest){
        return queryDoctorInfoService.getArrangement(docOrderRequest);
    }
}

